Search
Other DB Replacer questions
Forum

Replacing old {tab} ("with content") structure with new tab structure

Don Schaefer's Avatar Don Schaefer
Joomla! 3.10.11

I need to search and replace many instances of the old {tab} language with the new. You suggested DB Replacer Pro would be the tool to do that.

I know absolutely nothing about regular expressions or the columns in the db where they exist, so I'm at a loss.

Would you be able to help? Thx.
Peter van Westen's Avatar Peter van Westen ADMIN
If you want to replace something like:
{tab=Title}
to:
{tab title="Title"}

You can search for (with Regular Expressions on):
\{tab=([^\}]*)\}
And replace it with:
{tab title="\1"}

If you have any cases where you have added extra stuff in there, like a class name:
{tab=Title|green}
Then you'd have to deal with those first in a bit of a different way...
Please post a rating at the Joomla! Extensions Directory
Don Schaefer's Avatar Don Schaefer
Thank you. I do have to deal with extra stuff on some, not all. So I assume I'll have to deal with those in a different way.

{tab=title|blue|open}
and
{tab=title|blue}
Peter van Westen's Avatar Peter van Westen ADMIN
To replace:
{tab=...|...|open}
With:
{tab title="..." class="..." open="true"}

You can search for (with Regular Expressions on):
\{tab=([^\}\|]*)\|([^}\|]*)\|open\}
And replace it with:
{tab title="\1" class="\2" open="true"}

------------------

To replace:
{tab=...|...}
With:
{tab title="..." class="..."}

You can search for (with Regular Expressions on):
\{tab=([^\}\|]*)\|([^}\|]*)\}
And replace it with:
{tab title="\1" class="\2"}

------------------

To replace:
{tab=...}
With:
{tab title="..."}

You can search for (with Regular Expressions on):
\{tab=([^\}\|]*)\}
And replace it with:
{tab title="\1"}
Please post a rating at the Joomla! Extensions Directory
Don Schaefer's Avatar Don Schaefer
Thank you!

I worked thru the various expressions in this order:
{tab=...|...|open}
{tab=...|...}
{tab=...}
However, actual Tab Titles were replaced by a single letter when replacing
{tab=...}
The others I did not check (difficult to find in my large site) but I should have.

I restored the site rather than just the db b/c I'm not too swift with phpMyAdmin. 🙂
Peter van Westen's Avatar Peter van Westen ADMIN
Sorry, there were issues in the Regular Expressions in my previous post. I corrected them...
Please post a rating at the Joomla! Extensions Directory
Don Schaefer's Avatar Don Schaefer
Thank you, Peter! Over 400 instances replaced successfully. 🙂

Now I need to replace the old Slides with Sliders expressions. I can't use the same scripts as above, i.e., substituting {slide=} with {slide title=}, b/c the closing expression for Slides is {/sliders} not {/slides}. With Tabs, as you know, the closing expression stayed the same between old and new.

Can that be done?

Thank you.
Peter van Westen's Avatar Peter van Westen ADMIN
You can choose to change the tag words in the Sliders system plugin settings to whatever you want.
So instead of {slider ...}...{/sliders} you can make it use {slide ...}...{/slides} instead.

Or use DB Replacer to replace all those instances with 'slider' instead of 'slide'.

For the closing tags, do a simple text replacement, from:
{/slides}
To:
{/sliders}
Please post a rating at the Joomla! Extensions Directory
Jordan Weinstein's Avatar Jordan Weinstein
Hi Peter,

I tried searching for this with RegEx in DR:
{tab=([^}])*\}

But nothing was found, despite many instances of:
{tab=STRING}

When searching with RegEx off using
{tab=

Many are found
Jordan Weinstein's Avatar Jordan Weinstein
Ah....

In your example, the leading "\" was missing
Jordan Weinstein's Avatar Jordan Weinstein
When searching and replacing with:
\{tab=([^}])*\}
{tab title="\1"}

Only the last character in the title is preserved. So
{tab=Title}

became
{tab title="e"}
Peter van Westen's Avatar Peter van Westen ADMIN
Try:
\{tab=([^\}]*)\}
Please post a rating at the Joomla! Extensions Directory
Peter van Westen's Avatar Peter van Westen ADMIN
(Not sure why you moved the '*' character…)
Please post a rating at the Joomla! Extensions Directory
Jordan Weinstein's Avatar Jordan Weinstein
I copied it from your post above:
{tab=([^}])*\}

(from 7 months 1 week ago)
Peter van Westen's Avatar Peter van Westen ADMIN
Ah, yes, that was incorrect. It was correct in the following post.
Please post a rating at the Joomla! Extensions Directory
Jordan Weinstein's Avatar Jordan Weinstein
Great, that worked as expected. Thanks Peter.
You can only post on the extension support forum if you have an active subscription and you log in

Buy a Pro subscription